{extend name="layout/app" /}

{block name="title"}发长文{/block}

{block name="css"}
<link rel="stylesheet" href="/static/trumbowyg/trumbowyg.css">
<link rel="stylesheet" href="/static/summernote/summernote-bs5.css">
{/block}

{block name="main"}
<main role="main" class="d-flex flex-grow-1">
    <div class="d-flex main-wrap justify-content-between min-vh-100">
        <div class="primary-col">
            <!-- 顶部导航条 -->
            <div class="breadcrumb d-flex justify-content-between align-items-center px-3 js-scroll">
                <a href="/login" class="btn btn-sm btn-icon only-on-sm" role="button">
                    <i class="iconfont icon-user"></i>
                </a>
                <h2 class="fs-18px fw-bold cursor-pointer js-top">发长文</h2>
                <a class="btn btn-sm btn-icon" href="/blog/create" title="发长文">
                    <i class="iconfont icon-edit"></i>
                </a>
            </div>
            <form method="post" action="submit.php">
                <input type="text" id="title" class="form-control rounded-0 border-0 px-3 fs-5" name="title"
                    placeholder="文章标题" required autofocus>
                <textarea id="trumbowyg-editor" name="trumbowyg-editor"></textarea>
            </form>

            <form method="post">
                <textarea id="summernote" name="editordata"></textarea>
            </form>

        </div>
        <div class="sidebar-col">
            <div class="position-sticky sidebar-sticky">
                <div class="position-relative mt-2 mb-3">
                    <i class="iconfont icon-search search-iconfont"></i>
                    <input class="form-control rounded-5 search-input" type="text" placeholder="搜索">
                </div>
                <div class="tile mb-3">
                    <h2 class="mb-0 py-12px px-3 fs-6 fw-bold">每日帖不过３😉</h2>
                    <div class="px-3 pb-3">
                        <p class="mt-1 mb-3 fs-15px">友情提示，发帖和回帖都需要<i class="squiggle">扣除１枚金币</i>。</p>
                        <a class="btn btn-dark rounded-pill" href="/reward">领取今日登录奖励</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
{/block}

{block name="js"}
<script src="/static/trumbowyg/trumbowyg.min.js"></script>
<script src="/static/trumbowyg/langs/zh_cn.min.js"></script>
<script src="/static/trumbowyg/plugins/upload/trumbowyg.upload.min.js"></script>

<script src="/static/summernote/summernote-bs5.js"></script>
<script src="/static/summernote/summernote-zh-CN.js"></script>

<script>
    document.addEventListener("DOMContentLoaded", () => {
        // 当前链接添加 active
        highlightActiveLink("home");
        // 切换当前链接的 iconfont
        updateIconClassOnActive('.app-link', 'icon-home', 'icon-home-fill');
        // 编辑器
        $('#trumbowyg-editor').trumbowyg({
            lang: 'zh_cn',
            autogrow: true,
            removeformatPasted: true,
            autogrowOnEnter: true,
            minimalLinks: true,
            tagsToRemove: ['script', 'link'],
            toolbar: $('#toolbar'),
            btns: [
                ['formatting', 'strong', 'em'],
                ['emoji'],
                ['link'],
                ['insertImage'],
                ['upload'],
                ['table'],
                ['unorderedList', 'orderedList'],
                ['viewHTML']
            ]
        });
    });
    $(document).ready(function () {
        $('#summernote').summernote({
            lang: 'zh-CN',
            placeholder: 'Hello Bootstrap 5',
            height: 300,
            minHeight: null,
            maxHeight: null,
            focus: true,
            toolbar: [
                ['style', ['style']],
                ['font', ['bold', 'underline', 'clear']],
                ['para', ['ul', 'ol', 'paragraph']],
                ['table', ['table']],
                ['insert', ['link', 'picture', 'video']],
                ['view', ['fullscreen', 'codeview']]
            ]
        });
    });
</script>
{/block}